import request from "@/utils/request";

/**
 * 分页列表查询
 */
export const listPage = props => {
  return request({
    url: "/mall/tenant/merchant/delivery/order/list/page",
    method: "post",
    data: props
  });
};
/**
 * 创建人列表
 */
export const createUserList = props => {
  return request({
    url: "/mall/tenant/merchant/delivery/order/createUserList",
    method: "post",
    data: props
  });
};
/**
 * 删除
 */
export const delOrder = props => {
  return request({
    url: `/mall/tenant/merchant/delivery/order/delete/${props.deliveryId}`,
    method: "get"
  });
};
/**
 * 详情
 */
export const getDetail = props => {
  return request({
    url: `/mall/tenant/merchant/delivery/order/createOtherDeliveryOrderDetail/${props.deliveryId}`,
    method: "get"
  });
};

/**
 * 创建出库单-获取制单人、制单时间、出库编码信息
 */
export const createOtherDeliveryOrderInfo = props => {
  return request({
    url: props?.type
      ? `/mall/tenant/merchant/delivery/order/createOtherDeliveryOrderInfo/${props.type}`
      : "/mall/tenant/merchant/delivery/order/createOtherDeliveryOrderInfo/4",
    method: "get"
  });
};
/**
 * 创建出库单-获取商品分类
 */
export const getCategoryList = props => {
  return request({
    url: "/mall/tenant/inventory/allot/getCategoryList",
    method: "post",
    data: props
  });
};

/**
 * 创建出库单-选择商品-查询商品sku列表数据
 *
 */
export const getProductInventory = props => {
  return request({
    url: "/mall/tenant/inventory/allot/getProductInventory",
    method: "post",
    data: props
  });
};
/**
 * 创建出库单-选择商品-保存临时选择的商品
 *
 */
export const saveTempProductDelivery = props => {
  return request({
    url: "/mall/tenant/merchant/delivery/order/saveTempProductDelivery",
    method: "post",
    data: props
  });
};
/**
 * 创建出库单-选择商品-获取临时选择的商品
 *
 */
export const getTempProductSkuListDelivery = props => {
  return request({
    url: `/mall/tenant/merchant/delivery/order/getTempProductSkuListDelivery/${props.code}/${props.warehouseId}`,
    method: "get"
  });
};
/**
 * 创建出库单-选择商品-删除临时选择的商品
 *
 */
export const delTempProductSkuDelivery = props => {
  return request({
    url: `/mall/tenant/merchant/delivery/order/delTempProductSkuDelivery/${props.code}/${props.skuId}`,
    method: "get"
  });
};
/**
 * 创建出库单-确认创建出库单
 *
 */
export const crateOtherDeliveryOrder = props => {
  return request({
    url: "/mall/tenant/merchant/delivery/order/crateOtherDeliveryOrder",
    method: "post",
    data: props
  });
};
/**
 * 出库查询详情
 *
 */
export const createOtherDeliveryOrderDetail = props => {
  return request({
    url: `/mall/tenant/merchant/delivery/order/createOtherDeliveryOrderDetail/${props.deliveryId}`,
    method: "get"
  });
};
/**
 * 确认出库/撤销出库
 *
 */
export const delivery = props => {
  return request({
    url: "/mall/tenant/merchant/delivery/order/delivery",
    method: "post",
    data: props
  });
};
/**
 * 查询配送人
 *
 */
export const deliveryManQueryList = props => {
  return request({
    url: "/mall/tenant/merchant/delivery/order/deliveryManQueryList",
    method: "post",
    data: props
  });
};

/**
 * 添加配送人
 *
 */
export const addDeliveryMan = props => {
  return request({
    url: "/mall/tenant/merchant/delivery/order/addDeliveryMan",
    method: "post",
    data: props
  });
};
/**
 * 地址管理-查询接口
 *
 */
export const getAddressByOrderId = props => {
  return request({
    url: `/mall/tenant/merchant/delivery/order/getAddressByOrderId/${props.deliveryId}`,
    method: "get"
  });
};
/**
 * 地址管理-获取客户收货地址列表(有客户信息的时候，查询地址列表)
 *
 */
export const getCustomerAddressList = props => {
  return request({
    url: "/mall/tenant/merchant/order/getCustomerAddressList",
    method: "get",
    params: props
  });
};

/**
 * 地址管理-新增接口
 *
 */
export const saveCustomerAddress = props => {
  return request({
    url: "/mall/tenant/merchant/order/saveCustomerAddress",
    method: "post",
    data: props
  });
};
/**
 * 地址管理-删除接口
 *
 */
export const deleteCustomerAddress = props => {
  return request({
    url: "/mall/tenant/merchant/order/deleteCustomerAddress",
    method: "post",
    data: props
  });
};

//导出
export const download = props => {
  return request({
    url: "/mall/tenant/merchant/delivery/order/download",
    method: "post",
    responseType: "blob",
    data: props
  });
};

/**
 * 保存出库备注
 */
export const saveRemark = props => {
  return request({
    url: "/mall/tenant/merchant/delivery/order/saveRemark",
    method: "post",
    data: props
  });
};

/***
 * 关联客户列表
 *
 */
export const getCustomList = props => {
  return request({
    url: "/quote/budget/quotation/customAddress",
    method: "get",
    params: props
  });
};
